package main

import "fmt"

func main()  {
	//定义两个矩阵
	var arr1 = [3][3]int{}
	var arr2 = [3][3]int{}

	//赋值arr1
	for i := 0; i < 3; i++ {
		for j := 0; j < 3; j++ {
			fmt.Printf("请输入arr1[%d][%d]的值：", i, j)
			fmt.Scan(&arr1[i][j])
		}
	}
	//赋值arr2
	for i := 0; i < 3; i++ {
		for j := 0; j < 3; j++ {
			fmt.Printf("请输入arr2[%d][%d]的值：", i, j)
			fmt.Scan(&arr2[i][j])
		}
	}

	//求两矩阵和
	var sumarr = [3][3]int{}
	for i := 0; i < 3; i++ {
		for j := 0; j < 3; j++ {
			sumarr[i][j] = arr1[i][j] + arr2[i][j]
		}
	}
	fmt.Println("两矩阵的和是：",sumarr)
}
